package edu.fim.core.service.impl;

import java.sql.SQLException;

import edu.fim.core.service.ConsumerService;
import edu.fim.core.service.LoginService;
import edu.fim.core.service.locator.ServiceLocator;
import edu.fim.presentation.controller.ConsumerController;
import edu.fim.presentation.model.bean.Consumer;
import edu.fim.presentation.view.Form;
import edu.fim.presentation.view.MainForm;


public class LoginServiceImpl implements LoginService {

	public void login(String user, String password) throws SQLException {
		ConsumerService service = ServiceLocator.getImplementation(ConsumerService.class);
		Consumer consumer = service.findByUserAndPassword(user, password);
		ConsumerController consumerController = new ConsumerController(consumer);
		Form form = new MainForm("Menu", consumerController);
		form.setVisible(true);
	}
}